﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GenericLibrariesToolKit;
using GenericLibrariesToolKit.Enumeration;
using System.Data;
using Model;
using BLL.Info;
using BLL.Info.Impl;
using BLL.Users;
using BLL.Users.Impl;
public partial class Page_Events_EventInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack&&Request["eventID"] != null)
        {
            string eventID= Request["eventID"].ToString();
            showEventInfo(eventID);
            addClickAmount(eventID);
        }
    }
    public void showEventInfo(string eventID)
    {
        //设置where查询条件
        WhereCondition [] whereCondition=new WhereCondition[]
        {
            new WhereCondition(WhereJoinType.NULL,"EventId",MatchType.EQUAL,eventID),
        };
        EventBO eventBO=new EventBOImpl();
        //执行sql查询语句
        DataSet resultEvent = eventBO.GetDataSet(-1, -1, whereCondition);
        //绑定数据源
        dvEventsInfo.DataSource = resultEvent;
        dvEventsInfo.DataBind();

    }
    //返回上一页面
    protected void btnEventsInfoBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Write("<script language=javascript>history.go(-2);</script>");
    }
    /// <summary>
    /// 对该出版物的点击量加1
    /// </summary>
    private void addClickAmount(string eventID)
    {

        EventBO eventBO = new EventBOImpl();
        Event events = eventBO.Find(eventID);
        events.EventClickAmount++;
        eventBO.Update(events);

    }
}